local FightEffectHelper = {}

local EFFECT_MODULE = {
    "HERO",
    "EQUIPMENT",
    "MAGICKEY"
}

function FightEffectHelper.getFightEffects(heroUnit)
    local result = {}
    for i = 1, #EFFECT_MODULE do
        local name = EFFECT_MODULE[i]
        local effectFunc = FightEffectHelper["_" .. name .. "_EFFECT"]
        if effectFunc then
            effectFunc(heroUnit, result)
        end
    end
    return result
end

function FightEffectHelper._HERO_EFFECT(heroUnit, result)
    local HeroDataHelper = require("data.helper.HeroDataHelper")
    HeroDataHelper.getHeroEffect(heroUnit, result)
end

function FightEffectHelper._EQUIPMENT_EFFECT(heroUnit, result)
    local EquipDataHelper = require("data.helper.EquipDataHelper")
    local equipUnit = G_UserData:getBattle():getBattleEquipment(heroUnit:getPos())
    if equipUnit then
        EquipDataHelper.getEquipmentEffect(equipUnit, result)
    end
end

function FightEffectHelper._MAGICKEY_EFFECT(heroUnit, result)
    local magickeyId = heroUnit:getMagickeyId()
    if magickeyId > 0 then
        local MagicKeyDataHelper = require("data.helper.MagicKeyDataHelper")
        local unit = G_UserData:getMagickey():getUnitById(magickeyId)
        MagicKeyDataHelper.getMagicEffect(unit, result)
    end
end

return FightEffectHelper
